<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
	session_start();
	require_once("../db_connect.php");
	$Login_ID = "";

	$user_id  = $_SESSION['user_id'];
	$Family_Name  = htmlspecialchars($_POST['Family_Name'],ENT_QUOTES,"UTF-8");
	$Given_Name   = htmlspecialchars($_POST['Given_Name'],ENT_QUOTES,"UTF-8");
	$Family_Kana  = htmlspecialchars($_POST['Family_Kana'],ENT_QUOTES,"UTF-8");
	$Given_Kana   = htmlspecialchars($_POST['Given_Kana'],ENT_QUOTES,"UTF-8");

	$Nick_Name    = htmlspecialchars($_POST['Nick_Name'],ENT_QUOTES,"UTF-8");

	if (!empty($_POST['Login_ID']))
	{
		$Login_ID = htmlspecialchars($_POST['Login_ID'],ENT_QUOTES,"UTF-8");
	}

	$year         = date("Y-m-d",mktime(0,0,0,$_POST['month'],$_POST['day'],$_POST['year']));

	$Gender       = htmlspecialchars($_POST['Gender'],ENT_QUOTES,"UTF-8");
	$Position_ID  = htmlspecialchars($_POST['Position_ID'],ENT_QUOTES,"UTF-8");

	$Pref         = htmlspecialchars($_POST['Pref'],ENT_QUOTES,"UTF-8");
	$Phone_Number = htmlspecialchars($_POST['Phone_Number'],ENT_QUOTES,"UTF-8");
	$eMail        = htmlspecialchars($_POST['eMail'],ENT_QUOTES,"UTF-8");
	$K_eMail      = htmlspecialchars($_POST['K_eMail'],ENT_QUOTES,"UTF-8");

	$group_name	= htmlspecialchars($_POST['group_name'],ENT_QUOTES,"UTF-8");
	$group_kana	= htmlspecialchars($_POST['group_kana'],ENT_QUOTES,"UTF-8");
	$information	= htmlspecialchars($_POST['information'],ENT_QUOTES,"UTF-8");
	$url			= htmlspecialchars($_POST['url'],ENT_QUOTES,"UTF-8");
	$group_id		= htmlspecialchars($_POST['group_id'],ENT_QUOTES,"UTF-8");

	$sql = "UPDATE user
			SET family_name = ?,given_name = ?,family_kana = ?,given_kana = ?,nick_name = ?,login_id = ?,birth_day = ?,gender = ?,post_id = ?,pref = ?,phone_number = ?,email = ?,
				group_name = ?,group_kana = ?,information = ?,url = ?,group_id = ?
			WHERE user_id = ?";

	$stmt = $db->prepare($sql);

	$data = array($Family_Name,
                  $Given_Name,
                  $Family_Kana,
                  $Given_Kana,
                  $Nick_Name,
                  $Login_ID,
                  $year,
                  $Gender,
                  $Position_ID,
                  $Pref,
                  $Phone_Number,
                  $eMail,
                  $group_name,
                  $group_kana,
                  $information,
                  $url,
                  $group_id,
                  $user_id
	);

	$res =& $db->execute($stmt, $data);	//SQLを実行して、結果を $res に代入
	if (PEAR::isError($res)) {			//SQLの実行に失敗すればここでエラー文を出力
		die($res->getMessage());
	}

	echo "変更完了しました";
?>